cmake_minimum_required(VERSION 3.14.3 FATAL_ERROR)

project(my_test C CXX ASM)
enable_language(ASM)

#include(${HEXAGON_CMAKE_ROOT}/hexagon_fun.cmake)

if(HEXAGON_SDK_ROOT)
    include(${HEXAGON_SDK_ROOT}/build/cmake/hexagon_fun.cmake)
else()
    include(${HEXAGON_CMAKE_ROOT}/hexagon_fun.cmake)
endif()

set(HEXAGON TRUE)
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)


#set(prj_sources main.c src/contours.cpp)
set(prj_sources main.c 
    src/fft_test.cpp 
    src/fft_test2.cpp 
    src/fft_hvx_test.cpp 
    src/qhblas_cf_vector_add_acf.S 
    src/qhblas_cf_vector_mul_acf.S
    src/qhblas_vector_hadamard_af.S)

include_directories(${qhl_incs})
include_directories(${qhl_hvx_incs})


if(${DSP_VERSION} MATCHES "v66" OR ${DSP_VERSION} MATCHES "v65")
    add_compile_definitions(__V_DYNAMIC__)
else()
    add_compile_definitions(RUN_ON_V68 __V_DYNAMIC__)
endif()

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions -std=c++14")

add_executable(my_test_q ${prj_sources})

link_custom_library(my_test_q qhl BUILD_SOURCE)
#link_custom_library(my_test_q qhl_hvx BUILD_SOURCE)
link_custom_library(my_test_q qhl_hvx)
#link_custom_library(my_test_q qhl)

copy_binaries(my_test_q)
runHexagonSim(my_test_q)
